package org.xyl.game.tool.serializer;

import com.google.gson.*;
import io.swagger.models.auth.In;
import org.xyl.game.entity.Userinfo;

import java.lang.reflect.Type;

public class UserinfoSerializer implements JsonSerializer<Userinfo> {
    @Override
    public JsonElement serialize(Userinfo userinfo, Type type, JsonSerializationContext jsonSerializationContext) {
        JsonObject result = new JsonObject();
        result.add("userid", new JsonPrimitive(Integer.toString(userinfo.getUserid())));
        result.add("username",new JsonPrimitive(userinfo.getUsername()));
        return result;
    }
}
